Socket
Socket
Sign inDemoInstall

@highlight-ui/utils-commons

Package Overview
Dependencies
Maintainers
4
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@highlight-ui/utils-commons

A collection of helpers, global constants, shared types used by UI-components in Personio


Version published
Weekly downloads
2.2K
decreased by-13.99%
Maintainers
4
Weekly downloads
 
Created
Source

@highlight-ui/utils-commons

Installation

yarn add @highlight-ui/utils-commons

Usage

import utils from '@highlight-ui/utils-commons';

Exported Objects

NameDescription
ICON_MAPA map for associating validation states with icons
THEME_COLOR_TOKEN_MAPA map for associating themes with color tokens

Exported Types

NameDescription
FontFamilyValid FontAwesome family variants
LocaleUsed for internationalization
SizeAllowed size variants
ThemeAllowed themes
ColorTokenAllowed color tokens
DirectionUsed for positioning elements
ComponentMetadataUsed for specifying required data-attributes for e2e tests
ParsedMetadataSame as ComponentMetadata but every attribute is prefixed with data-*
PropsWithMetadataUtility type for adding metadata to a component's props
OutlineVariantAllowed outlines on input elements
ValidationStatusUsed for specifying validations status for a message or a file

Exported Functions

parseMetadata()

Takes an object and converts all of its properties to valid HTML data attributes.

import utils from '@highlight-ui/utils-commons';

const metadata = {
  firstAttribute: '1',
  secondAttribute: '2',
};

const parsedMetadata = utils.parseMetadata(metadata);

console.log(parsedMetadata);
/*
  Output:
 {
  'data-first-attribute': '1',
  'data-second-attribute': '2',
  }
*/

forkHandlers()

Receives an array of callbacks and returns a function that accepts an event argument that will be passed to every callback in the array.

import utils from '@highlight-ui/utils-commons';

const MyComponent = () => {
  const handleClick = utils.forkHandlers([
    () => {
      console.log('first handler');
    },
    () => {
      console.log('second handler');
    },
    (event) => {
      event.preventDefault();
      console.log('third handler');
    },
  ]);

  return <div onClick={handleClick}>Click Me</div>;
};

FAQs

Package last updated on 26 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc